import request from '@/utils/request'

const api_name = '/eduservice/question'

export default {
  // 添加题目
  save(question) {
    return request({
      url: `${api_name}/save`,
      method: 'post',
      data: question
    })
  },
  
  // 更新题目
  update(question) {
    return request({
      url: `${api_name}/update`,
      method: 'post',
      data: question
    })
  },
  
  // 获取题目详情
  getById(id) {
    return request({
      url: `${api_name}/get/${id}`,
      method: 'get'
    })
  },
  
  // 条件查询带分页
  getPageList(page, limit, searchObj) {
    return request({
      url: `${api_name}/pageListQuestionCondition/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },
  
  // 删除题目
  removeById(id) {
    return request({
      url: `${api_name}/remove/${id}`,
      method: 'delete'
    })
  },
  
  // 获取所有课程列表
  getCourseList() {
    return request({
      url: '/eduservice/course/list',
      method: 'get'
    })
  },
  
  // 根据课程ID获取章节列表
  getChapterListByCourseId(courseId) {
    return request({
      url: `/eduservice/chapter/getChapterVideo/${courseId}`,
      method: 'get'
    })
  }
}